﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ChineseSchool.BLL;
using ChineseSchool.Models.Hethong;

namespace ChineseSchool.UserControl.ThuNghiem
{
    public partial class Pages : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            lblContent.Text = LoadPageContent();
        }

        public string LoadPageContent()
        {
            var strPage = "";
            if (Request.QueryString["id"] == null || Request.QueryString["id"] == "") return strPage;
            var menuId = int.Parse(Request.QueryString["id"]);
            var mPage = new M_Page();
            var lstPage = (new B_Page()).GetBy_MenuID(menuId);
            var pageContent = "Trang web đang được xây dựng! Vui lòng trở lại sau!";
            if (lstPage.Count > 0)
            {
                var title = lstPage[0].title;
                pageContent = lstPage[0].pageContent;
                //lblTitle.Text = title;
                lblTopTitle.Text = title;
                Page.Title = "" + title + "";
                Page.MetaDescription = "" + title + "";
                Page.MetaKeywords = "" + title + "";
            }
            else
            {
                Page.Title = "Học tiếng trung hiệu quả";
            }
            strPage += "<div>" + pageContent + "</div>";
            return strPage;
        }
    }
}